from google.appengine.ext.webapp.util import run_wsgi_app
from kr.community.controls.Ajax import AjaxJoin, AjaxLogin, AjaxChangePwd
from kr.community.controls.Join import JoinPage, JoinConfirm
from kr.community.controls.change_pwd import ChangePwdPage
from kr.community.controls.chat import ChatPage, Disconnected, Connected, \
    PostMsg
from kr.community.controls.gallery import GalleryPage, UploadImage, ServeImage, \
    GalleryPostPage, ServeContent
from kr.community.controls.login import LoginPage
from kr.community.controls.logout import LogoutPage
from kr.community.controls.main import MainPage
from kr.community.controls.notice import NoticePage
import logging
import webapp2

application = webapp2.WSGIApplication([
                                      ('/', MainPage),
                                      ('/login/', LoginPage),
                                      ('/logout/', LogoutPage),
                                      ('/join/', JoinPage),
                                      ('/join/confirm/', JoinConfirm),
                                      ('/change_pwd/', ChangePwdPage),
                                      ('/chat/', ChatPage),
                                      ('/chat/post/', PostMsg),
                                      ('/notice/', NoticePage),
                                      ('/gallery/', GalleryPage),
                                      ('/gallery/post/', GalleryPostPage),
                                      ('/gallery/upload/', UploadImage),
                                      ('/gallery/serve/([^/]+)?', ServeImage),
                                      ('/gallery/serve/content/([^/]+)?', ServeContent),
                                      ('/_ah/channel/disconnected/', Disconnected),
                                      ('/_ah/channel/connected/', Connected),
                                      ('/ajax/join/', AjaxJoin),
                                      ('/ajax/login/', AjaxLogin),
                                      ('/ajax/change_pwd/', AjaxChangePwd),
                                      ], debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    logging.getLogger().setLevel(logging.DEBUG)
    main()